package com.example.xuwsh.redis;

/**
 * @Author: xwensh
 * @Date : 2022/7/3 21:09
 * @Version
 * @Describe redis锁
 */
public class RedisLockToolParams {
    private String key;
    private Long time = 2 * 60L;
    private Boolean autoUnLock = Boolean.FALSE;

    public String getKey() {
        return key;
    }

    public RedisLockToolParams setKey(String key) {
        this.key = key;
        return this;
    }

    public Long getTime() {
        return time;
    }

    public RedisLockToolParams setTime(Long time) {
        this.time = time;
        return this;
    }

    public Boolean getAutoUnLock() {
        return autoUnLock;
    }

    public RedisLockToolParams setAutoUnLock(Boolean autoUnLock) {
        this.autoUnLock = autoUnLock;
        return this;
    }

    public Boolean needAutoUnLock() {
        return autoUnLock;
    }

    public static RedisLockToolParams create(String key) {
        return new RedisLockToolParams().setKey(key);
    }
}
